<?php include(VIEWSPATH.'/common/header.php') ?>
<style>
	table#tbl_search td{
		text-align:left;
	}
</style>
<script>
	$(document).ready(function(){
		$("#btn_delete").click(function(){
			var ids = "";
			var curr_url = window.location.href ;
			
			$("input[type=checkbox]:checked").each(function(){
				ids = ids + this.value +",";
			});
			ids = ids.substring(0,ids.length -1);
			$.ajax({
				url:"<?php echo base_url('product/delete');?>",
				dataType :"json",
				data:{
					'ma_aodai': ids 
				},
				 type: "POST",
				success:function(data){
					alert("đã xóa thành công ");
					window.location=curr_url;				
				}
			});
		});
	});
</script>


<div style="text-align:left;padding-bottom:5px;">
	<input type="button" value="Xoá" id="btn_delete" ></input>
	<input type="button" value="Thêm Áo Dài" onclick="redirect_page('<?php echo base_url('product/add');?>')"></input>
	<input type="button" value="Xem Thông Tin Loại Áo" onclick="redirect_page('<?php echo base_url('product/theloai');?>')"></input>
	
</div>
<table class="list_product" cellspacing="0" width="500">
	<tr>
		<th> </th>
		<th>STT</th>
		<th>Hình Ảnh</th>
		<th>Giá Tiền</th>
		<th>Ghi Chú</th>
		<th></th>
	</tr>
	<?php $i =1 ?>
	<?php	foreach ($data as $row) { ?>
	<tr>
		<td align="center" ><input type="checkbox" id="ckb_<?php echo $row -> id ?>" value="<?php echo $row -> id ?>"></input>
		<td align="center"><?php echo $i ?></td>
		<td align="center"><img height="60" class="img_list"  id="img_small_<?php echo $row -> id ?>" src="<?php echo base_url('/assets/image/aodai/'.($row -> id %10)."/".$row->image); ?>"></img></td>
		<td align="right"> <?php  echo preg_replace("/^(\d+)(\d\d\d)/i", "$1,$2", $row -> price);  ?> <span class="money">VNĐ</span></td>
		<td align="center"> <?php echo ($row->note !='' ? $row->note : '--') ?></td>
		<td align="center"><a href="<?php echo base_url('product/view/').$row -> id ?>" >Xem chi tiet</a></td>
		<?php $i = $i + 1 ?>
	</tr>
	<?php   }?>
</table>

<div id="str_paging" ><?php echo $str_paging ; ?></div>

<?php include(VIEWSPATH.'/common/footer.php') ?>